package liyasong.tool.crawler;

import java.util.List;

import org.horrabin.horrorss.RssChannelBean;
import org.horrabin.horrorss.RssFeed;
import org.horrabin.horrorss.RssImageBean;
import org.horrabin.horrorss.RssItemBean;
import org.horrabin.horrorss.RssParser;

public class SmallTry {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		RssParser rss = new RssParser();

		try{
		        RssFeed feed = rss.load("http://firecacada.blog.163.com/rss/");
		        
		        // Gets the channel information of the feed and 
		        // display its title
		        RssChannelBean channel = feed.getChannel();
		        System.out.println("Feed Title: " + channel.getTitle());
		        
		        // Gets the image of the feed and display the image URL
		        RssImageBean image = feed.getImage();
		        System.out.println("Feed Image: " + image.getUrl());
		        
		        // Gets and iterate the items of the feed 
		        List<RssItemBean> items = feed.getItems();
		        for (int i=0; i<items.size(); i++){
		             RssItemBean item = items.get(i); 
		             System.out.println("Title: " + item.getTitle());
		             System.out.println("Link : " + item.getLink());
//		             System.out.println("Desc.: " + item.getDescription());                             
		        }
		        
		}catch(Exception e){
		        // Something to do if an exception occurs
		}
	}

}
